<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<title>Document</title>
	<style type="text/css">
		
		.con{
			width: 400px;
			height: 400px;
			border: 1px solid #000;
			margin: 50px auto 0px;
			position: relative;
			
		}

		.con div{
			width: 200px;
			height: 200px;
			position: absolute;
		}

		.box1{
			background-color: pink;
			left: 20px;
			top: 20px;

			/*z-index:层级设置 数值越大层级月靠前(盖过其他元素)*/
			z-index: 10;
		}

		.box2{
			background-color: yellow;
			left: 40px;
			top: 40px;
			z-index: 11;			
		}

		.box3{
			background-color: red;
			left: 60px;
			top: 60px;
			z-index: 12;			
		}


		.box4{
			background-color: purple;
			left: 80px;
			top: 80px;			
		}

	</style>
</head>
<body>
	<div class="con">
		<div class="box1"></div>
		<div class="box2"></div>
		<div class="box3"></div>
		<div class="box4"></div>
	</div>
</body>
</html>